//---------------------------------------------------------------------------------------------------------------------
// import json module
var fso = new ActiveXObject("Scripting.FileSystemObject");
eval(fso.OpenTextFile("json2.js",1).ReadAll());


//---------------------------------------------------------------------------------------------------------------------
var misptemp_name = 'misptemp';
var mispfile_name = 'mispfile';
var source_name = 'source.src';
var target_name = 'target.trg';


//---------------------------------------------------------------------------------------------------------------------
// init misp data
var misp_data = {};
misp_data['configs'] = {};
var configs = misp_data['configs'];
misp_data['phases'] = [];
var phases = misp_data['phases'];

// add configs
configs['clean_config'] = []
configs['build_config'] = []

// add clean phase
configs['clean_config'].push('clean_phase')
phases.push({
	'id': 'clean_phase',
	'formulas': {}
	});
var formulas = phases[phases.length-1]['formulas'];
// add clean formula
formulas['clean_formula'] = {
		'actions' : [
			['-s','del '+target_name],
			['-s','del '+mispfile_name]
		]
	};

// add build phase
configs['build_config'].push('build_phase')
phases.push({
	'id': 'build_phase',
	'formulas': {}
	});
var formulas = phases[phases.length-1]['formulas'];
// add build formula
formulas['build_formula'] = {
		'sources': [ source_name ],
		'targets': [ target_name ],
		'actions' : [
			['s', 'copy /y '+source_name+' '+target_name]
		]
	};

// save mispfile
var ofile = fso.CreateTextFile(misptemp_name);
ofile.Write(JSON.stringify(misp_data));
ofile.close();
